<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>bison.ParserEngine</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css"></link>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">

<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="bison-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          PyBison&nbsp;API&nbsp;Reference
      </p></th></tr></table>
    </th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <font size="-1"><b class="breadcrumbs">
        <a href="bison-module.html">Module&nbsp;bison</a> ::
        Class&nbsp;ParserEngine
      </b></font></br>
    </td>
    <td><table cellpadding="0" cellspacing="0">
      <tr><td align="right"><font size="-2">[<a href="../private/bison.ParserEngine-class.html">show&nbsp;private</a>&nbsp;|&nbsp;hide&nbsp;private]</font></td></tr>
      <tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a>&nbsp;|&nbsp;<a href="bison.ParserEngine-class.html" target="_top">no&nbsp;frames</a>]</font></td></tr>
    </table></td>
</tr></table>

<!-- =========== START OF CLASS DESCRIPTION =========== -->
<h2 class="class">Class ParserEngine</h2>

<pre class="base-tree">
<a href="__builtin__.object-class.html"><code>object</code></a> --+
         |
        <b>ParserEngine</b>
</pre><br />

<hr/>

<p>Wraps the interface to the binary bison/lex-generated parser engine 
dynamic library.</p>
<p>You shouldn't need to deal with this at all.</p>
Takes care of:
<ul>
  <li>
    building the library (if the parser rules have changed)
  </li>
  <li>
    loading the library and extracting the parser entry point
  </li>
  <li>
    calling the entry point
  </li>
  <li>
    closing the library
  </li>
</ul>
Makes direct calls to the platform-dependent routines in 
bisondynlib-[linux|windows].c
<hr/>


<!-- =========== START OF METHOD SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Method Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="bison.ParserEngine-class.html#__init__" class="summary-sig-name"><code>__init__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
x.__init__(...) initializes x; see x.__class__.__doc__ for 
signature</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="bison.ParserEngine-class.html#__del__" class="summary-sig-name"><code>__del__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
Clean up and bail</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="bison.ParserEngine-class.html#buildLib" class="summary-sig-name"><code>buildLib</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
Creates the parser engine lib</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="bison.ParserEngine-class.html#closeLib" class="summary-sig-name"><code>closeLib</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
Does the necessary cleanups and closes the parser library</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="bison.ParserEngine-class.html#openCurrentLib" class="summary-sig-name"><code>openCurrentLib</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
Tests if library exists and is current.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="bison.ParserEngine-class.html#openLib" class="summary-sig-name"><code>openLib</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
Loads the parser engine's dynamic library, and extracts the following 
symbols:</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="bison.ParserEngine-class.html#runEngine" class="summary-sig-name"><code>runEngine</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
Runs the binary parser engine, as loaded from the lib</td></tr>
<tr bgcolor="#e8f0f8" class="group">
  <th colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;Inherited from object</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__delattr__" class="summary-sig-name"><code>__delattr__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
x.__delattr__('name') &lt;==&gt; del x.name</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__getattribute__" class="summary-sig-name"><code>__getattribute__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
x.__getattribute__('name') &lt;==&gt; x.name</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__hash__" class="summary-sig-name"><code>__hash__</code></a>(<span class=summary-sig-arg>x</span>)</span></code>
<br />
x.__hash__() &lt;==&gt; hash(x)</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__reduce__" class="summary-sig-name"><code>__reduce__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
helper for pickle</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__reduce_ex__" class="summary-sig-name"><code>__reduce_ex__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
helper for pickle</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__repr__" class="summary-sig-name"><code>__repr__</code></a>(<span class=summary-sig-arg>x</span>)</span></code>
<br />
x.__repr__() &lt;==&gt; repr(x)</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__setattr__" class="summary-sig-name"><code>__setattr__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
x.__setattr__('name', value) &lt;==&gt; x.name = value</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__str__" class="summary-sig-name"><code>__str__</code></a>(<span class=summary-sig-arg>x</span>)</span></code>
<br />
x.__str__() &lt;==&gt; str(x)</td></tr>
<tr bgcolor="#e8f0f8" class="group">
  <th colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;Inherited from type</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.type-class.html#__new__" class="summary-sig-name"><code>__new__</code></a>(<span class=summary-sig-arg>T</span>,
          <span class=summary-sig-arg>S</span>,
          <span class="summary-sig-vararg">...</span>)</span></code>
<br />
T.__new__(S, ...) -&gt; a new object with type S, a subtype of T</td></tr>
</table><br />


<!-- =========== START OF METHOD DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
  <th colspan="2">Method Details</th></tr>
</table>

<a name="__init__"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-vararg">...</span>)</span>
    <br /><i>(Constructor)</i>
  </h3>
  x.__init__(...) initializes x; see x.__class__.__doc__ for 
  signature
  <dl><dt></dt><dd>
    <dl><dt><b>Overrides:</b></dt>
      <dd><a href="__builtin__.object-class.html#__init__"><code>__builtin__.object.__init__</code></a></dd>
    </dl>
  </dd></dl>
</td></tr></table>

<a name="__del__"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">__del__</span>(<span class="sig-vararg">...</span>)</span>
    <br /><i>(Destructor)</i>
  </h3>
  Clean up and bail
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="buildLib"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">buildLib</span>(<span class="sig-vararg">...</span>)</span>
  </h3>
  <p>Creates the parser engine lib</p>
  This consists of:
  <ol start="1">
    <li>
      Ripping the tokens list, precedences, start target, handler 
      docstrings and lex script from this Parser instance's attribs and 
      methods
    </li>
    <li>
      Creating bison and lex files
    </li>
    <li>
      Compiling bison/lex files to C
    </li>
    <li>
      Compiling the C files, and link into a dynamic lib
    </li>
  </ol>
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="closeLib"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">closeLib</span>(<span class="sig-vararg">...</span>)</span>
  </h3>
  Does the necessary cleanups and closes the parser library
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="openCurrentLib"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">openCurrentLib</span>(<span class="sig-vararg">...</span>)</span>
  </h3>
  <p>Tests if library exists and is current. If not, builds a fresh 
  one</p>
  Opens the library
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="openLib"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">openLib</span>(<span class="sig-vararg">...</span>)</span>
  </h3>
  Loads the parser engine's dynamic library, and extracts the 
  following symbols:
  <ul>
    <li>
      void *do_parse() (runs parser)
    </li>
    <li>
      char *parserHash (contains hash of python parser rules)
    </li>
  </ul>
  <p>Returns lib handle, plus pointer to do_parse() function, as long 
  ints (which later need to be cast to pointers)</p>
  Important note -this is totally linux-specific. If you want windows 
  support, you'll have to modify these funcs to use glib instead (or 
  create windows equivalents), in which case I'd greatly appreciate you 
  sending me a patch.
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="runEngine"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">runEngine</span>(<span class="sig-vararg">...</span>)</span>
  </h3>
  Runs the binary parser engine, as loaded from the lib
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>
<br />


<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="bison-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          PyBison&nbsp;API&nbsp;Reference
      </p></th></tr></table>
    </th>
  </tr>
</table>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td align="left"><font size="-2">Generated by Epydoc 2.0 on Fri Apr 23 19:00:01 2004</font></td>
    <td align="right"><a href="http://epydoc.sourceforge.net"
                      ><font size="-2">http://epydoc.sf.net</font></a></td>
  </tr>
</table>
</body>
</html>
